package cloud.api.controller;

import cloud.api.controller.base.BaseController;
import cloud.api.model.ReturnModel;
import cloud.api.service.IAppleService;
import cloud.api.service.IMenuService;
import cloud.common.util.Jurisdiction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("apple")
public class AppleController extends BaseController {

    @Autowired
    private IAppleService appService;
    private String menuUrl = "app/list";
    @RequestMapping("/list")
    public String list(Model model){
        model.addAttribute("apple",appService.getAllApple());
        return "page/app/list";
    }
    /**
     * 编辑用户
     * @return
     */
    @RequestMapping(value="/editApple",method=RequestMethod.POST)
    @ResponseBody
    public void editRole(){
        if(!Jurisdiction.buttonJurisdiction(menuUrl,"edit", this.getSession())){ ReturnModel.getNotAuthModel();}
         appService.editApple(this.getParameterMap());
    }
}
